package com.pp.controller;

import com.pp.common.pojo.District;
import com.pp.common.vo.SysResult;
import com.pp.service.DistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/api/district")
public class DistrictController {

    @Autowired
    private DistrictService districtService;

    @GetMapping("/{parentCode}")
    public SysResult getDistrict(@PathVariable String parentCode) {
        List<District> districtList = districtService.getByParentCode(parentCode);
        return SysResult.success(districtList);
    }


}
